﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataAccess;
using System.Data;

namespace BusinessLogic
{
    public class DiaDiem
    {
        Data da = new Data();

        public DataTable ShowDiaDiem()
        {
            string sql = "select * from DiaDiem";
            DataTable dt =  new DataTable();
            dt = da.GetTable(sql);
            return dt;
        }

        public void InsertDiaDiem(string mdd, string tdd)
        {
            string sql = "insert DiaDiem values ('"+mdd+"',N'"+tdd+"')";
            da.ExcuteNonQuery(sql); //lệnh thực thi không trả về bảng
        }

        public void UpdateDiaDiem(string mdd1, string mdd, string tdd)
        {
            string sql = "update DiaDiem set MaDiaDiem ='"+mdd+"',TenDiaDiem ='"+tdd+"' where MaDiaDiem ='"+mdd1+"'";
            da.ExcuteNonQuery(sql);
        }

        public void DeleteDiaDiem(string mdd)
        {
            string sql = "delete DiaDiem where MaDiaDiem ='"+mdd+"'";
            da.ExcuteNonQuery(sql);
        }
    }
}
